//
//  GTHTTPRequestSerializer.h
//  GTNetWorking
//
//  Created by Mr.Wei on 2021/2/24.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface GTHTTPRequestSerializer : NSObject

@property (nonatomic, assign) NSStringEncoding stringEncoding;

@property (nonatomic, assign) BOOL allowsCellularAccess;//`YES` by default.

@property (nonatomic, assign) NSURLRequestCachePolicy cachePolicy;//`NSURLRequestUseProtocolCachePolicy` by default.

@property (nonatomic, assign) BOOL HTTPShouldHandleCookies;//`YES` by default.

@property (nonatomic, assign) BOOL HTTPShouldUsePipelining;//`NO` by default.

@property (nonatomic, assign) NSURLRequestNetworkServiceType networkServiceType;// `NSURLNetworkServiceTypeDefault` by default.

@property (nonatomic, assign) NSTimeInterval timeoutInterval;//The default timeout interval is 60 seconds.

@property (readonly, nonatomic, strong) NSDictionary <NSString *, NSString *> *HTTPRequestHeaders;

@property (nonatomic, strong) NSSet <NSString *> *HTTPMethodsEncodingParametersInURI;

+ (instancetype)serializer;

- (void)setValue:(nullable NSString *)value forHTTPHeaderField:(NSString *)field;

- (nullable NSString *)valueForHTTPHeaderField:(NSString *)field;

- (void)setAuthorizationHeaderFieldWithUsername:(NSString *)username
                                       password:(NSString *)password;

- (void)clearAuthorizationHeader;

- (nullable NSMutableURLRequest *)requestWithMethod:(NSString *)method
                                          URLString:(NSString *)URLString
                                         parameters:(nullable id)parameters
                                              error:(NSError * _Nullable __autoreleasing *)error;
@end

NS_ASSUME_NONNULL_END
